#pragma once

#include "GLDrawable.h"

class GLRect : public GLDrawable
{
	using Super = GLDrawable;

public:
	using Super::Super;
	void initData();

	void updateData();
	void updateVAO();
	void paint(QOpenGLShaderProgram* program, const QMatrix4x4& mvpMat);

	void setVisible(bool v)
	{
		mVisible = v;
	}
	bool isVisible() const
	{
		return mVisible;
	}

public:
	void setStart(const QPoint& pos)
	{
		mStart = pos;
	}
	void setStop(const QPoint& pos)
	{
		mStop = pos;
	}

	const QPoint& start() const
	{
		return mStart;
	}
	const QPoint& stop() const
	{
		return mStop;
	}
	void setColor(QColor c)
	{
		mColor = c;
	}
	const QColor& color() const
	{
		return mColor;
	}
	void setLineWidth(int v)
	{
		mLineWidth = v;
	}
	const int& lineWidth() const
	{
		return mLineWidth;
	}

private:
	QPoint			   mStart;
	QPoint			   mStop;
	QColor			   mColor	  = QColor("#00FFFF");
	int				   mLineWidth = 1;
	QVector<QVector3D> mVertices;
	GLuint			   mVBO		= 0;
	GLuint			   mVAO		= 0;
	bool			   mVisible = false;
};
